package com.example.lte.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotEmpty;

/**
 * @author lzh
 * @date 2020/10/22 - 18:28
 */
@Data
// 注册为组件
@Component
// 启用配置自动注入功能
@EnableConfigurationProperties
//指定类对应的配置项前缀
@ConfigurationProperties(prefix = "local-system")
//启动校验-只需要在我们创建的配置Properties类增加Validation相关配置即可
@Validated
public class LocalSystemConfig {

    @NotEmpty(message = "yml配置文件配置必须要配置[local-system.app-name]属性")
    private String appName;
    @NotEmpty(message = "yml配置文件配置必须要配置[local-system.app-version]属性")
    private String appVersion;
    @NotEmpty(message = "yml配置文件配置必须要配置[local-system.app-chinese-name]属性")
    private String appChineseName;





}
